﻿@{
    ViewBag.Title = "患者性质";
    Layout = "~/Views/Shared/_Index.cshtml";
}
<script>
    $(function () {
        gridList();
    });
    function gridList() {
        var $gridList = $("#gridList");
        $gridList.dataGrid({
            treeGrid: true,
            treeGridModel: "adjacency",
            ExpandColumn: "brxz",
            postData: { keyword: $("#txt_keyword").val() },
            url: "/SystemManage/PatientCharacteristics/GetTreeGridJson",
            height: 420,
            colModel: [
                { label: '主键', name: 'brxzbh', hidden: true, key: true },
                { label: '患者性质', name: 'brxzmc', width: 170, algin: 'left' },
                { label: '编码', name: 'brxz', width: 100, algin: 'left' },
                {
                    label: '门诊住院标志', name: 'mzzybz', width: 100, algin: 'left',
                    formatter: function (cellvalue) {
                        return $.enum.getDescByValue("Enummzzybz", cellvalue);
                    }
                },
                 {
                     label: '性质类别(卡)', name: 'brxzlb', width: 100, algin: 'left',
                     formatter: function (cellvalue) {
                         return $.enum.getDescByValue("EnumJykxzlx", cellvalue);
                     }
                 },
                {
                    label: '医保交易类型', name: 'ybjylx', width: 100, algin: 'left', formatter: function (cellvalue) {
                        return $.enum.getDescByValue("EnumYBJYLX", cellvalue);
                    }
                },
                { label: '医保险种标志', name: 'insutype', width: 80, algin: 'left', },
                { label: '备注', name: 'bz', width: 100, algin: 'left', }
            ],
            pager: "#gridPager",
            sortname: 'CreateTime desc',
            viewrecords: true
        });
        $("#btn_search").click(function () {
            $gridList.jqGrid('setGridParam',
                {
                    postData: { keyword: $("#txt_keyword").val() }
                }).trigger('reloadGrid');
        });
    }

    function btn_add() {
        $.modalOpen({
            id: "Form",
            title: "患者性质维护",
            url: "/SystemManage/PatientCharacteristics/Form",
            width: "700px",
            height: "600px",
            showleftlalbel: true,
            callBack: function (iframeId, leftlabel) {
                top.frames[iframeId].submitForm(leftlabel);
            }
        });
    }

    function btn_edit() {
        var seleRowid = jQuery("#gridList").jqGrid("getGridParam", "selrow");
        if (!(seleRowid)) {
            $.modalAlert("请先选中一条信息", 'warning');
            return;
        }
        var keyValue = $("#gridList").jqGridRowValue().brxzbh;
        $.modalOpen({
            id: "Form",
            title: "修改信息",
            url: "/SystemManage/PatientCharacteristics/Form?keyValue=" + keyValue,
            width: "700px",
            height: "600px",
            callBack: function (iframeId) {
                top.frames[iframeId].submitForm();
            }
        });
    }
    function btn_delete() {
        var seleRowid = jQuery("#gridList").jqGrid("getGridParam", "selrow");
        if (!(seleRowid)) {
            $.modalAlert("请先选中一条信息", 'warning');
            return;
        }
        $.deleteForm({
            url: "/SystemManage/PatientCharacteristics/DeleteForm",
            param: { keyValue: $("#gridList").jqGridRowValue().brxzbh },
            success: function () {
                $.currentWindow().$("#gridList").resetSelection();
                $.currentWindow().$("#gridList").trigger("reloadGrid");
            }
        });
    }
    function btn_details() {
        var seleRowid = jQuery("#gridList").jqGrid("getGridParam", "selrow");
        if (!(seleRowid)) {
            $.modalAlert("请先选中一条信息", 'warning');
            return;
        }
        var keyValue = $("#gridList").jqGridRowValue().brxzbh;
        $.modalOpen({
            id: "Details",
            title: "查看",
            url: "/SystemManage/PatientCharacteristics/Form?keyValue=" + keyValue,
            width: "700px",
            height: "600px",
            btn: null
        });
    }
</script>

<form>
    <div class="topPanel">
        <div class="toolbar">
            <div class="btn-group">
                <a id="NF-add" class="btn btn-primary dropdown-text" onclick="btn_add()"><i class="fa fa-plus"></i>新建</a>
            </div>
            <div class="btn-group">
                <a id="NF-edit" class="btn btn-primary dropdown-text" onclick="btn_edit()"><i class="fa fa-pencil-square-o"></i>修改</a>
            </div>
            <div class="btn-group">
                <a id="NF-delete" class="btn btn-primary dropdown-text" onclick="btn_delete()"><i class="fa fa-trash-o"></i>删除</a>
            </div>
            <div class="btn-group">
                <a id="NF-Details" class="btn btn-primary dropdown-text" onclick="btn_details()"><i class="fa fa-search-plus"></i>查看</a>
            </div>
        </div>
        <div class="search">
            <table>
                <tr>
                    <td>
                        <div class="input-group">
                            <input id="txt_keyword" type="text" class="form-control" placeholder="项目名称/项目代码" style="width: 200px;">
                            <span class="input-group-btn">
                                <button id="btn_search" type="button" class="btn  btn-primary"><i class="fa fa-search"></i></button>
                            </span>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div class="gridPanel">
        <table id="gridList"></table>
        <div id="gridPager"></div>
    </div>
</form>
